Add GTK_DEBUG=shortcuts
authorMatthias Clasen <mclasen@redhat.com>
Fri, 29 May 2020 21:58:33 +0000 (17:58 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 29 May 2020 21:59:58 +0000 (17:59 -0400)
If the shortcuts debug flag is set, print out
shortcut activations.

gtk/gtkdebug.h
gtk/gtkmain.c
gtk/gtkshortcutaction.c

index d3ef264cd11a7787cd3ab7bce7d25038d74f37db..a615921b196241793fedbb66a62d9961a44efcd9 100644 (file)
@@ -45,6 +45,7 @@ typedef enum {
   GTK_DEBUG_BUILDER         = 1 <<  7,
   GTK_DEBUG_SIZE_REQUEST    = 1 <<  8,
   GTK_DEBUG_NO_CSS_CACHE    = 1 <<  9,
+  GTK_DEBUG_SHORTCUTS       = 1 << 10,
   GTK_DEBUG_INTERACTIVE     = 1 << 11,
   GTK_DEBUG_TOUCHSCREEN     = 1 << 12,
   GTK_DEBUG_ACTIONS         = 1 << 13,
index 0088a5d8c1cb46029554a423575414121b17c5fb..03437167cffa6229a07a01d29d49882b91115ac1 100644 (file)
@@ -170,6 +170,7 @@ static const GDebugKey gtk_debug_keys[] = {
   { "builder", GTK_DEBUG_BUILDER },
   { "size-request", GTK_DEBUG_SIZE_REQUEST },
   { "no-css-cache", GTK_DEBUG_NO_CSS_CACHE },
+  { "shortcuts", GTK_DEBUG_SHORTCUTS },
   { "interactive", GTK_DEBUG_INTERACTIVE },
   { "touchscreen", GTK_DEBUG_TOUCHSCREEN },
   { "actions", GTK_DEBUG_ACTIONS },
index d831ce42bd7de148e667cc566933a26e47ad22a2..98f113c947aa911987250109fc2c5cef6a73f77a 100644 (file)
@@ -56,6 +56,7 @@
 #include "gtkbuilder.h"
 #include "gtkintl.h"
 #include "gtkwidgetprivate.h"
+#include "gtkdebug.h"
 
 /* {{{ GtkShortcutAction */
 
@@ -158,6 +159,12 @@ gtk_shortcut_action_activate (GtkShortcutAction      *self,
   g_return_val_if_fail (GTK_IS_SHORTCUT_ACTION (self), FALSE);
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
+  GTK_NOTE (SHORTCUTS, {
+            char *act = gtk_shortcut_action_to_string (self);
+            g_print ("Shortcut action activate on %s: %s\n", G_OBJECT_TYPE_NAME (widget), act);
+            g_free (act);
+            });
+
   return GTK_SHORTCUT_ACTION_GET_CLASS (self)->activate (self, flags, widget, args);
 }